package com.dwxt.mall.admin.controller;

import com.dwxt.common.base.BaseResult;
import com.dwxt.mall.admin.service.CustomerServiceAdmin;
import com.dwxt.mall.entity.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("/mall/customer")
@RestController
public class CustomerControllerAdmin {

    @Autowired
    private CustomerServiceAdmin customerServiceAdmin;

    @RequestMapping("/selectAllCustomer")
    public BaseResult selectAllCustomer() {
        List<CustomerService> customerServices = customerServiceAdmin.selectAllCustomer();
        return BaseResult.ok(customerServices);
    }

    @RequestMapping("/updateCustomer")
    public BaseResult updateCustomer(CustomerService customerService){
        customerServiceAdmin.updateByPrimaryKey(customerService);
        return BaseResult.ok();
    }
}
